﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="../Js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#Text1").blur(function () {
                var name = $("#Text1").val();
                $.post("GetPrice.ashx", { "name": name }, function (data,status) {
                    if (status == "success"){
                        var arrs = data.split("|");
                        if (arrs[0]=="ok") {
                            $("#Text2").val(arrs[1]);
                        } else if (arrs[0]=="no") {
                            $("#Text2").val("暂无此商品价格！");
                        } else {
                            alert("数据格式错误！");
                        }
                    } else {
                        alert("Ajax请求失败！");
                    }
                });
            });
        });

    </script>
</head>
<body>

    <p>
        <input id="Text1" type="text" /><input id="Text2" type="text" />
    </p>

</body>
</html>
